﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SLControlLibrary.Resources.Controls.Calendar.OutlookCalendar
{
    public class ucTimeSlotItem : Control
    {
        #region Dependency Variables
        private static readonly DependencyProperty HourProperty = DependencyProperty.Register("Hour", typeof(string), typeof(ucTimeSlotItem), new PropertyMetadata(null, new PropertyChangedCallback(Hour_Changed)));
        private static readonly DependencyProperty MinuteProperty = DependencyProperty.Register("Minute", typeof(string), typeof(ucTimeSlotItem), new PropertyMetadata(null, new PropertyChangedCallback(Minute_Changed)));
        #endregion

        #region Dependency Properties
        public string Hour 
        {
            get { return this.GetValue(HourProperty).ToString(); }
            set { this.SetValue(HourProperty, value); } 
        }
        public string Minute 
        {
            get { return this.GetValue(MinuteProperty).ToString(); }
            set { this.SetValue(MinuteProperty, value); } 
        }
        #endregion

        #region Dependency Events
        #region Hour_Changed
        private static void Hour_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucTimeSlotItem).OnHour_Changed(e);
        }
        #endregion

        #region Minute_Changed
        private static void Minute_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucTimeSlotItem).OnMinute_Changed(e);
        }
        #endregion
        #endregion

        #region Constructor
        public ucTimeSlotItem()
        {
            DefaultStyleKey = typeof(ucTimeSlotItem);
        }
        #endregion

        #region Methods
        #region OnHour_Changed
        protected virtual void OnHour_Changed(DependencyPropertyChangedEventArgs e)
        {
            Hour = e.NewValue.ToString();
        }
        #endregion

        #region OnMinute_Changed
        protected virtual void OnMinute_Changed(DependencyPropertyChangedEventArgs e)
        {
            Minute = e.NewValue.ToString();
        }
        #endregion
        #endregion
    }
}
